!/bin/sh
SYS_USAGE_MAX=80


CPULOG_1=$(cat /proc/stat | grep 'cpu ' | awk '{print $2" "$3" "$4" "$5" "$6" "$7" "$8}') 

SYS_IDLE_1=$(echo $CPULOG_1 | awk '{print $4}') 

Total_1=$(echo $CPULOG_1 | awk '{print $8+$2+$3+$4+$5+$6+$7}') 

#echo $Total_1

CPULOG_2=$(cat /proc/stat | grep 'cpu ' | awk '{print $2" "$3" "$4" "$5" "$6" "$7" "$8}') 

SYS_IDLE_2=$(echo $CPULOG_2 | awk '{print $4}')

Total_2=$(echo $CPULOG_2 | awk '{print $8+$2+$3+$4+$5+$6+$7}') 

#echo $Total_2

SYS_IDLE=`expr $SYS_IDLE_2 - $SYS_IDLE_1` 

#echo 'sys_idle = '$SYS_IDLE

Total=`expr $Total_2 - $Total_1` 

#echo 'cpu useage is: '$Total

let SS=$SYS_IDLE*100/$Total

let SYS_USAGE=100-$SS

echo $SYS_USAGE

if[$SYS_USAGE -lt $SYS_USAGE_MAX]
echo 'use normal'
